def selection(x):
  "Uses Selection Sort to sort a passed list"
  l = len(x)

  for i in range(l-1):
    min_element = x[i]
    min_pos = i

    for j in range(i, l):
      if x[j] < min_element:
        min_element = x[j]
        min_pos = j

    if i != min_pos:
      t = x[min_pos]
      x[min_pos] = x[i]
      x[i] = t

  return x

if __name__ == "__main__":
  a = [1,2,4,5]
  b = []
  c = [2,1,4,34,1,3]
  d = ['a','c','b','a','df']

  print selection(a)
  print selection(b)
  print selection(c)
  print selection(d)
